#include<iostream>
#include<sstream>
#include<cstdlib>

using namespace std;

int main(int argc,char * argv[]){
  if(argc<3) {
    cerr<<"Usage: <input rows> <input cols>\n";
    return 1;
  }
  int arg=0;
  int rows = atoi(argv[++arg]);
  int cols = atoi(argv[++arg]);
  
  float * mat = new float[rows*cols];
  string line;
  for(int i=0;i<rows;++i){
    getline(cin,line);
    istringstream iss(line);
    for(int j=0;j<cols;++j){
      iss>>mat[i*cols+j];
    }
  }
  for(int j=0;j<cols;++j){
    for(int i=0;i<rows;++i){
      if (i) cout<<"\t";
      cout<<mat[i*cols+j];
    }
    cout<<endl;
  }
  return 0;
}
